package com.roadmap.biz.life.blog;

import com.roadmap.biz.common.BaseManager;
import com.roadmap.common.BaseEntity;
import com.roadmap.entities.Article;
import com.roadmap.entities.Aspirant;
import com.roadmap.exception.InvalidQueryException;
import com.roadmap.exception.InvalidValueException;
import com.roadmap.exception.NullObjectException;
import com.roadmap.exception.ServerException;

public class ArticleManager extends BaseManager {

	public ArticleManager(String currentUser, String itemOwner) {
		super(currentUser, itemOwner, Article.class, Aspirant.class);
	}

	@Override
	public BaseEntity get(String entityId) throws NullObjectException,
			InvalidQueryException, ServerException, InvalidValueException {
		String hql = "from Article where id=? and aspirantId=?";
		Object[] params = {entityId, getOwnerId()};
		return (BaseEntity)getDbUtil().getUniqueEntity(hql, params);
	}
}
